Inferring Type Isomorphisms Generically

نویسندگان

  • Frank Atanassow
  • Johan Jeuring
چکیده

Datatypes which differ inessentially in their names and structure are said to be isomorphic; for example, a ternary product is isomorphic to a nested pair of binary products. In some canonical cases, the conversion function is uniquely determined solely by the two types involved. In this article we describe and implement a program in Generic Haskell which automatically infers this function by normalizing types w.r.t. an algebraic theory of canonical isomorphisms. A simple generalization of this technique also allows to infer some non-invertible coercions such as projections, injections and ad hoc coercions between base types. We explain how this technique has been used to drastically improve the usability of a Haskell–XML Schema data binding, and suggest how it might be applied to improve other type-safe language embeddings.

برای دانلود رایگان متن کامل این مقاله و بیش از 32 میلیون مقاله دیگر ابتدا ثبت نام کنید

ثبت نام

اگر عضو سایت هستید لطفا وارد حساب کاربری خود شوید

منابع مشابه

Inferring Type Isomorphisms Generically — With an application to an XML Schema–Haskell data binding

1 1 Introduction Typed functional languages like Haskell [35] and ML [24,33] typically support the declaration of user-defined, polymorphic algebraic datatypes. In Haskell, for example, we might define a datatype representing dates in a number of ways. The most straightforward and conventional definition is probably the one given by Date below,

متن کامل

Type isomorphisms simplify XML programming

A program that processes XML documents can be implemented using an XML data binding. Programming with an XML data binding can be painful, because the classes or types generated by the data binding are not in the style native to the host language. JAXB, a Java-XML data binding, supports binding customizations to mitigate this problem. Programming with a type-safe binding such as our HaskellXML d...

متن کامل

Amalgamated duplication of some special rings along an ideal

Let be a commutative Noetherian ring and let I be a proper ideal of . D’Anna and Fontana in [6] introduced a new construction of ring,  named amalgamated duplication of along I. In this paper by considering the ring homomorphism , it is shown that if , then , also it is proved that if , then there exists  such that . Using this result it is shown that if is generically Cohen-Macaulay (resp. gen...

متن کامل

Applications of the Kleisli and Eilenberg-Moore 2-adjunctions

In 2010, J. Climent Vidal and J. Soliveres Tur developed, among other things, a pair of 2-adjunctions between the 2-category of adjunctions and the 2-category of monads. One is related to the Kleisli adjunction and the other to the Eilenberg-Moore adjunction for a given monad.Since any 2-adjunction induces certain natural isomorphisms of categories, these can be used to classify bijection...

متن کامل

Second-Order Type Isomorphisms Through Game Semantics

The characterization of second-order type isomorphisms is a purely syntactical problem that we propose to study under the enlightenment of game semantics. We study this question in the case of second-order λμ-calculus, which can be seen as an extension of system F to classical logic, and for which we define a categorical framework: control hyperdoctrines. Our game model of λμ-calculus is based ...

متن کامل

ذخیره در منابع من


  با ذخیره ی این منبع در منابع من، دسترسی به آن را برای استفاده های بعدی آسان تر کنید

عنوان ژورنال:

دوره   شماره 

صفحات  -

تاریخ انتشار 2004